package com.gfxy.service.impl;

import cn.hutool.crypto.SecureUtil;
import com.gfxy.mapper.UserMapper;
import com.gfxy.service.IUserService;
import com.gfxy.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public int registerUser(User user){

//        user.setPassword(SecureUtil.md5(user.getPassword()));

        return userMapper.insertUser(user);
    }

    @Override
    public int loginUser(User user) {
//        user.setPassword(SecureUtil.md5(user.getPassword()));
        User resuser = userMapper.selectUser(user);
        if(resuser!=null){
            return 1;
        }

        return 0;
    }

    @Override
    public int deleteNoticeById(Integer id) {
        return 0;
    }
}
